﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
    <input id="Text1" style="width: 300px; height: 21px;" type="text" onkeyup="getA();"
        onclick="getxy(this);" />
    <script type="text/javascript">
        //getxy()代码,为将要显示的div确定位置 
        function getxy(e) {
            x = e.offsetTop; y = e.offsetLeft; while (e = e.offsetParent)
            { x += e.offsetTop; y += e.offsetLeft; }
        }
        function getQList() {
            var time = new Date().getTime();
            var val = document.getElementById("Text1").value;
            if (val != null || val != "" || val.length != 0) {
                var send = "action=get1&time=" + time + "&val=" + val;
                myRequest("~/Temp.aspx", send, getQListhandle);
            }
        }

        //处理函数,创建表格,填充到div中,代码中的changeColor()是用于鼠标移动后改变颜色的. 
        function getQListhandle() {
            var getXML = null;
            if (req.readyState == 4) {
                if (req.status == 200) {
                    getXML = req.responseXML;
                    var innerHTML = null;
                    var newslist = getXML.getElementsByTagName("news");
                    if ((newslist != null) && (newslist.length != 0)) {
                        innerHTML = "<table style=\"font-size: 9pt;width:100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\r\n";

                        for (var i = 0; i < newslist.length; i++) {
                            var news = newslist[i];
                            var id = (news.childNodes[0].firstChild == null) ? "" : news.childNodes[0].firstChild.data;
                            var caption = (news.childNodes[1].firstChild == null) ? "" : news.childNodes[1].firstChild.data;
                            innerHTML += "<tr onmouseover=\"changecolor1(this);\" onmouseout=\"changecolor2(this);\">";
                            innerHTML += "<td  height='25'  style=\"cursor:hand\" onclick=\"look2('" + id + "');\">" + caption + "</td>";
                            innerHTML += "</tr>";
                        }
                        innerHTML += "</table>\r\n";
                    }
                    else {
                        //innerHTML += "暂时没有数据"; 
                        document.getElementById("list").innerHTML = "";
                        document.getElementById("list").style.display = "none";
                    }
                    setLocal(); //注意,此处定位Div的位置  
                }
            }
        }
        function setLocal() {
            var list = document.getElementById("list");
            list.style.top = x + 21;
            list.style.left = y;
        }
    </script>
</body>
</html>
